<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
    
    <head>
        <meta charset="utf-8">
        <title>
            首页图片管理
        </title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="/css/x-admin.css" media="all">
    </head>
    
    <body>
        <div class="x-body">
            <form class="layui-form">
                <div class="layui-form-item">
                    <label for="link" class="layui-form-label">
                        <span class="x-red">*</span>首页图片
                    </label>
                    <div class="layui-input-inline">
                        <div class="site-demo-upbar">
                            <input type="file" name="upfile" class="layui-upload-file" id="test">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="link" class="layui-form-label">
                        <span class="x-red">*</span>图片预览
                    </label>
                    <div class="layui-input-inline" id="productImage">
                        <div class="site-demo-upbar">

                        </div>
                    </div>
                </div>

            </form>

        </div>
        <script src="/js/jquery-2.2.4.min.js" charset="utf-8">
        </script>
        <script src="/lib/layui/layui.js" charset="utf-8">
        </script>
        <script src="/js/x-layui.js" charset="utf-8">
        </script>
        <script src="/js/vue.js" charset="utf-8">
        </script>
        <script>

            var imageFilename = '';
            layui.use(['form','layer', 'upload'], function(){
                $ = layui.jquery;
              var form = layui.form();
              var layer = layui.layer;

                layui.upload({
                    url: '/bo/homePicture/upload.html', //上传接口
                    success: function(res){ //上传成功后的回调
                        imageFilename = res.data.filename;
                        $('#productImage').html('<img src="'+ res.data.imageUrl +'" width="100px" height="40px">');
                    }
                });

              //监听提交
            });

        </script>
        <script>

        </script>
    </body>

</html>